﻿var t = moment();
document.getElementById("tex_end_time").value = t.format("YYYY-MM-DDTHH:MM");
t.add(-1, "month");
document.getElementById("tex_start_time").value = t.format("YYYY-MM-DDTHH:MM");

//时间、次序颠倒时交换
function weight_range_and_cutlength_and_time(a, b) {
    var x, y;
    x = document.getElementById(a);
    y = document.getElementById(b);

    if (x.value != "" && y.value != "" && x.value > y.value) {
        let tt = x.value;
        x.value = y.value;
        y.value = tt;
    }
}


var inputs = document.getElementsByTagName("input");
for (let i = 0; i < inputs.length; i++) {
    if (inputs[i].type != "datetime-local") {
        inputs[i].addEventListener("input", function (event) {
            event.target.value = event.target.value.replace(/\-/g, "")
        })
    };
}
